package list_map;

import java.util.*;

/**
 * @program: javase
 * @description:
 * @author: lld
 * @create: 2020-11-04 19:09
 **/
public class Test {
    public static void main(String[] args) {
//        List<list_map.User> list=new ArrayList<>();
//        list.add(new list_map.User(1, "23","1234"));
//        if(list.contains(new list_map.User(1, "23","5678"))){
//            System.out.println(true);
//        }
        Queue queue=new LinkedList();
        HashSet<User> hashSet=new HashSet<>();
        User u1 = new User(1, "111", "111");
        User u2 = new User(2, "222", "222");
        hashSet.add(u1);
        hashSet.add(u2);
//        System.out.println(hashSet);

        u2.setName("22222");//没有改变hashcode
        hashSet.remove(u2);//根据name='22222'重新生成hashcode,根据hashcode删除不了
        System.out.println(hashSet);
        hashSet.add(new User(2, "22222", "222"));//上面22222没有改变hashcode
        System.out.println(hashSet);
        hashSet.add(new User(2, "2121", "222"));
        System.out.println(hashSet);

    }
}
